{% extends 'rest_framework/base.html' %}
{% load i18n %}
{% load rest_framework %}

{% block meta %}
{{ block.super }}
        <meta http-equiv="Content-Security-Policy"
              content="default-src 'self'; child-src 'none'; style-src 'self' 'nonce-{{ csp_nonce }}'; script-src 'self' 'nonce-{{ csp_nonce }}'">
{% endblock %}

{% block title %}{% trans 'Galaxy REST API' %}{% endblock %}

{% block style %}
{{ block.super }}
<link rel="shortcut icon" type="image/x-icon" href="/assets/favicon.ico">
<style type="text/css" nonce="{{ csp_nonce }}">

html body {
  background: #ddd;
}
html body .navbar {
  background-color: #1d1d1d;
}
html body .navbar .navbar-inner {
  border-top: none;
  height: 54px;
}
html body .navbar-inverse .navbar-inner {
    background-color: #171717;
    background-image: -moz-linear-gradient(top, #171717, #171717);
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#171717), to(#171717));
    background-image: -webkit-linear-gradient(top, #171717, #171717);
    background-image: -o-linear-gradient(top, #171717, #171717);
    background-image: linear-gradient(to bottom, #171717, #171717);
    background-repeat: repeat-x;
    border-color: #171717;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#171717', endColorstr='#171717', GradientType=0);
}
html body .navbar-inverse .nav > li > a {
    color: #A9A9A9;
}
html body .navbar-inverse .nav > li > a:hover,
html body .navbar-inverse .nav > li > a:focus {
   color: #2078be;
}
html body .navbar .brand img {
    height: 35px;
    width: 120px;
}
html body .navbar-inverse .nav li.dropdown.open > .dropdown-toggle,
html body .navbar-inverse .nav li.dropdown.active > .dropdown-toggle,
html body .navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle {
  background-color: #074979;
}
html body .navbar-inverse .brand {
    position: relative;
    top: 3px;
    font-size: 2.2em;
    color: #fff;
}
html body .navbar-inverse .nav.pull-right {
  margin-top: 8px;
  margin-right: -8px;
}
html body ul.breadcrumb {
  margin-top: 72px;
}
span.powered-by .version {
  color: #ddd;
}
span.powered-by {
  font-size: 75%;
  color: #ddd;
}
html body .navbar .navbar-inner .dropdown-menu li a,
html body .navbar .navbar-inner .dropdown-menu li,
html body .hero-unit h2,
html body .hero-unit h1,
html body a {
 color: #2078be;
}
html body a span {
 color: #2078be !important;
}
html body .navbar .navbar-inner .dropdown-menu li a:hover,
html body a:hover {
  color: #2078be;
}
html body ul.breadcrumb,
html body .prettyprint,
html body .well.tab-content {
  border: 1px solid #ccc;
}
html body .prettyprint {
  background: #f5f5f5;
}
html body .str,
html body .atv,
html body code {
  color: #074979;
}
html body .str a {
  text-decoration: underline;
}
html body .page-header {
  margin-bottom: 0;
}
html body .description {
  padding-bottom: 0;
  display: none;
}
#footer {
  font-size: 0.8em;
  text-align: center;
  padding-bottom: 1em;
}
#footer a,
#footer a:hover {
  color: #333;
}
html body .wrapper {
  min-height: 1%;
  height: auto !important;
  margin: 0 auto 0;
}
html body #footer {
  height: auto !important;
}
html body #push {
	height: 0;
}
</style>
{% endblock %}

{% block branding %}
  <a class="brand" href="/api/"><img src="/assets/galaxy-logo-02.svg"></a>
{% endblock %}

{% block content %}
  <div class="region"  aria-label="{% trans "request form" %}">
  {% if 'GET' in allowed_methods %}
    <form id="get-form" class="pull-right">
      <fieldset>
        {% if api_settings.URL_FORMAT_OVERRIDE %}
          <div class="btn-group format-selection">
            <a class="btn btn-primary js-tooltip" href="{{ request.get_full_path }}" rel="nofollow" title="Make a GET request on the {{ name }} resource">GET</a>

            <button class="btn btn-primary dropdown-toggle js-tooltip" data-toggle="dropdown" title="Specify a format for the GET request">
              <span class="caret"></span>
            </button>
            <ul class="dropdown-menu">
              {% for format in available_formats %}
                <li>
                  <a class="js-tooltip format-option" href="{% add_query_param request api_settings.URL_FORMAT_OVERRIDE format %}" rel="nofollow" title="Make a GET request on the {{ name }} resource with the format set to `{{ format }}`">{{ format }}</a>
                </li>
              {% endfor %}
            </ul>
          </div>
        {% else %}
          <a class="btn btn-primary js-tooltip" href="{{ request.get_full_path }}" rel="nofollow" title="Make a GET request on the {{ name }} resource">GET</a>
        {% endif %}
      </fieldset>
    </form>
  {% endif %}

  {% if filter_form %}
    <button style="float: right; margin-right: 10px" data-toggle="modal" data-target="#filtersModal" class="btn btn-default">
      <span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
      {% trans "Filters" %}
    </button>
  {% endif %}
  </div>

    <div class="content-main" role="main"  aria-label="{% trans "main content" %}">
      <div class="page-header">
        <h1>{{ name }}</h1>
      </div>
      <div style="float:left">
        {% block description %}
          {{ description }}
        {% endblock %}
      </div>

      {% if paginator %}
        <nav style="float: right">
          {% get_pagination_html paginator %}
        </nav>
      {% endif %}

      <div class="request-info" style="clear: both" aria-label="{% trans "request info" %}">
        <pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>
      </div>

      <div class="response-info" aria-label="{% trans "response info" %}">
        <pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}{% for key, val in response_headers|items %}
  <b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize_quoted_links }}</span>{% endfor %}

  </span>{{ content|urlize_quoted_links }}</pre>{% endautoescape %}
      </div>
    </div>
{% endblock content %}

{% block script %}
{{ block.super }}
<script type="text/javascript" nonce="{{ csp_nonce }}">
$(function() {
  // Make links from relative URLs to resources.
  $('span.str').each(function() {
    var s = $(this).html();
    if (s.match(/^\"\/.+\/\"$/) || s.match(/^\"\/.+\/\?.*\"$/)) {
      $(this).html('"<a href=' + s + '>' + s.replace(/\"/g, '') + '</a>"');
    }
  });
  $('.btn-primary').removeClass('btn-primary').addClass('btn-success');
});
</script>
{% endblock %}
